﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Domain.Core.Specification;
using Cesave.Domain.PermisosModule.Resources;

namespace Cesave.Domain.PermisosModule.Contracts.Acreditaciones
{
    public class AcreditacionByGuidSpecification
        :Specification<Acreditacion>
    {
        #region Privates propierties

        private Guid _acreditacionGuid = default(Guid);

        #endregion  

        #region Constructor

        public AcreditacionByGuidSpecification(Guid acreditacionGuid)
        {
            if (acreditacionGuid == Guid.Empty)
                throw new InvalidOperationException(Messages.exception_InvalidArgument);
            _acreditacionGuid = acreditacionGuid;
        }

        #endregion  

        #region Specification overrides

        public override System.Linq.Expressions.Expression<Func<Acreditacion, bool>> SatisfiedBy()
        {
            Specification<Acreditacion> specification = new DirectSpecification<Acreditacion>(acreditacion => acreditacion.AcreditacionGuid == _acreditacionGuid);
            return specification.SatisfiedBy();
        }
        #endregion

    }
}
